home *** CD-ROM | disk | FTP | other *** search
/ Visual Intercept / Visual Intercept.iso / sheriff.z / isacctfn.bas next >
BASIC Source File  |  1996-08-26  |  6KB  |  175 lines

  1. Attribute VB_Name = "IIAccount"
  2. '----------------------------------------------------------------------------
  3. '   isacctfn.bas is a member of the Visual Intercept Visual Basic API.
  4. '   Copyright (c) 1996 Elsinore Technologies, Inc. All rights reserved.
  5. '
  6. '   This software is protected by copyright law. Unauthorized reproduction
  7. '   or distribution of this program, or any portion of it, may result in
  8. '   severe civil or criminal penalties. If you have any questions about
  9. '   your redistribution rights, please contact Elsinore Technologies, Inc.
  10. '
  11. '   Creator: Albert J. Lin (AJL)
  12. '   History: Created 09/17/95
  13. '----------------------------------------------------------------------------
  14.  
  15.  
  16. '----------------------------------------------------------------------------
  17. ' Visual Intercept Account Declaration:
  18. '----------------------------------------------------------------------------
  19. Public Type VIAccount
  20.     code                    As String
  21.     name                    As String
  22.     userID                  As String
  23.     description             As String
  24.     rate                    As Double
  25. End Type
  26.  
  27. Public Type IEAccount
  28.     lpCode                  As String
  29.     lpName                  As String
  30.     lpUserID                As String
  31.     lpDescription           As String
  32.     rate                    As Double
  33.     
  34.     lnCode                  As Integer
  35.     lnName                  As Integer
  36.     lnUserID                As Integer
  37.     lnDescription           As Integer
  38. End Type
  39.  
  40. '/*  Account API.          */
  41. Public Declare Function IIInsertAccount Lib "isapi.dll" (pAccount As IEAccount) As Long
  42. Public Declare Function IIDeleteAccount Lib "isapi.dll" (pAccount As IEAccount, ByVal clause As String) As Long
  43. Public Declare Function IIModifyAccount Lib "isapi.dll" (pAccount As IEAccount, ByVal clause As String) As Long
  44. Public Declare Function IIFetchAccount Lib "isapi.dll" (pAccount As IEAccount, ByVal clause As String) As Long
  45. Public Declare Function IIFetchAccounts Lib "isapi.dll" (ByRef pnTotal As Long, ByVal clause As String) As Long
  46. Public Declare Function IIGetAccount Lib "isapi.dll" (pAccount As IEAccount, ByVal nIndex As Long) As Long
  47.  
  48. Public Function VBIIInitAccount(account As IEAccount)
  49.    
  50.     account.lnCode = lnIIAccountCode
  51.     account.lnName = lnIIAccountName
  52.     account.lnUserID = lnIIUserID
  53.     account.lnDescription = lnIIDescription
  54.   
  55.     account.lpCode = String(account.lnCode, 0)
  56.     account.lpName = String(account.lnName, 0)
  57.     account.lpUserID = String(account.lnUserID, 0)
  58.     account.lpDescription = String(account.lnDescription, 0)
  59.     account.rate = 0
  60.  
  61. End Function
  62.  
  63. Public Function VBIIConvertAccount(account As IEAccount, userAccount As VIAccount)
  64.   
  65.     userAccount.code = account.lpCode
  66.     userAccount.name = account.lpName
  67.     userAccount.userID = account.lpUserID
  68.     userAccount.description = account.lpDescription
  69.     userAccount.rate = account.rate
  70.     
  71. End Function
  72.  
  73.  
  74.  
  75. Public Function VBIIInsertAccount(userAccount As VIAccount) As Long
  76.     Dim account As IEAccount
  77.     Dim err As Long
  78.     
  79.     Call VBIIInitAccount(account)
  80.     
  81.     Call VBIIPrepareAccount(account, userAccount)
  82.     
  83.     err = IIInsertAccount(account)
  84.     
  85.     VBIIInsertAccount = err
  86.     
  87. End Function
  88.  
  89. Public Function VBIIDeleteAccount(userAccount As VIAccount, ByRef clause As String) As Long
  90.     Dim account As IEAccount
  91.     Dim err As Long
  92.         
  93.     Call VBIIInitAccount(account)
  94.     
  95.     Call VBIIPrepareAccount(account, userAccount)
  96.     
  97.     rError = IIDeleteAccount(account, clause)
  98.     
  99.     VBIIDeleteAccount = err
  100.     
  101. End Function
  102.  
  103. Public Function VBIIFetchAccount(userAccount As VIAccount, ByRef clause As String) As Long
  104.     Dim account As IEAccount
  105.     Dim err As Long
  106.     
  107.     Call VBIIInitAccount(account)
  108.     
  109.     Call VBIIPrepareAccount(account, userAccount)
  110.     
  111.     err = IIFetchAccount(account, clause)
  112.     
  113.     If err = 0 Then
  114.         Call VBIIConvertAccount(account, userAccount)
  115.     End If
  116.     
  117.     VBIIFetchAccount = err
  118.     
  119. End Function
  120.  
  121. Public Function VBIIModifyAccount(userAccount As VIAccount, ByRef clause As String) As Long
  122.     Dim account As IEAccount
  123.     Dim err As Long
  124.     
  125.     Call VBIIInitAccount(account)
  126.     
  127.     Call VBIIPrepareAccount(account, userAccount)
  128.     
  129.     err = IIModifyAccount(account, clause)
  130.     
  131.     VBIIModifyAccount = err
  132.     
  133. End Function
  134.  
  135. Public Function VBIIPrepareAccount(account As IEAccount, userAccount As VIAccount)
  136.     
  137.     account.lpCode = userAccount.code
  138.     account.lpName = userAccount.name
  139.     account.lpUserID = userAccount.userID
  140.     account.lpDescription = userAccount.description
  141.     account.rate = userAccount.rate
  142.     
  143.     account.lnCode = Len(userAccount.code)
  144.     account.lnName = Len(userAccount.name)
  145.     account.lnUserID = Len(userAccount.userID)
  146.     account.lnDescription = Len(userAccount.description)
  147.  
  148. End Function
  149.  
  150. Public Function VBIIFetchAccounts(ByRef rnTotal As Long, ByRef clause As String) As Long
  151.     Dim err As Long
  152.         
  153.     err = IIFetchAccounts(rnTotal, clause)
  154.  
  155.     VBIIFetchAccounts = err
  156.     
  157. End Function
  158.  
  159. Public Function VBIIGetAccount(userAccount As VIAccount, ByVal nIndex As Long) As Long
  160.     Dim account As IEAccount
  161.     Dim err As Long
  162.     
  163.     Call VBIIInitAccount(account)
  164.     
  165.     err = IIGetAccount(account, nIndex)
  166.  
  167.     If err = 0 Then
  168.         Call VBIIConvertAccount(account, userAccount)
  169.     End If
  170.     
  171.     VBIIGetAccount = err
  172.     
  173. End Function
  174.  
  175.